﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MVCPets;
using MVCPets.Controllers;
using MVCPets.Data;
using MVCPets.Models;

namespace MVCPets.Tests.Controllers
{
  [TestClass]
  public class RoleManagementControllerTest
  {
    [TestMethod]
    public void Index()
    {
      // Arrange
      var controller = new RoleManagementController();

      // Act
      var result = controller.Index() as ViewResult;

      // Assert
      var list = result.ViewData.Model as List<RoleModel>;
      var role = list.First();

      Assert.AreEqual("Administrator", role.RoleName);
      Assert.AreEqual(1000, role.RoleValue);
    }

    [TestMethod]
    public void Edit()
    {
      // Arrange
      var controller = new RoleManagementController();

      // Act
      var result = controller.Edit(1) as ViewResult;
      var role = result.ViewData.Model as RoleModel;
      
      // Assert
      Assert.AreEqual("Administrator", role.RoleName);
      Assert.AreEqual(1000, role.RoleValue);
    }
  }
}
